home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / dskut / 2m21.zip / 2M-TECH.DOC < prev    next >
Text File  |  1994-05-31  |  12KB  |  213 lines

  1.  
  2.                     TECHNICAL INFORMATION FOR PROGRAMMERS
  3.                     -------------------------------------
  4.  
  5.       2M access always directly to NEC765 diskette controller chip and 8237
  6. DMA controller. But you haven't to do the same!.  The standard DOS and BIOS
  7. functions still works when 2M is installed, supporting new diskette formats
  8. as standard ones.  If you need to format a 2M diskette from your high-level
  9. applications, this is possible also via standard INT 13h function 5.
  10.  
  11.       When 2M is installed on memory,  INT 13h  service 5 becomes increased
  12. its functionality. To find 2M resident on memory:
  13.  
  14.          Load AL with 0.
  15.          Load ES:DI with 1492h:1992h.
  16.          Load AH with a value from 0C0h to 0FFh.
  17.          Call INT 2Fh.
  18.  
  19.       When INT 2Fh returns, if AL=0FFh and ES:DI points a "CiriSOFT:2M:2.1"
  20. null terminated string...  2M is in memory!.   Note that ':' is a delimiter
  21. and not always CiriSOFT will be  the  manufacturer  (I recomend search only
  22. for the ":2M:" and ":2MX:" substrings). You can begin scanning with AH=0C0h
  23. and, if not found 2M or 2MX there,  continue with AH=0C1h and so on.  If 2M
  24. has been loaded from booting a 2M disk,  format functions are not available
  25. (and 2M installation check will correctly fail).
  26.  
  27.       When you had detected 2M on memory,  you can call to INT 13h function
  28. 5 to format a diskette track.  This  is easiest than standard BIOS service:
  29. you don't need to select the disk density,  media,  or  last  sector in the
  30. track. Of course, the standard BIOS function is still available but you can
  31. call INT 13h as bellow:
  32.  
  33.          Load AH with 5.
  34.          Load AL with 7Fh.
  35.          Load CH with track number.
  36.          Load DH with head number.
  37.          Load DL with drive number.
  38.          Load SI with 324Dh signature ("2M").
  39.          Load ES:BX pointing to boot sector of future 2M diskette.
  40.  
  41.       Note that in standard BIOS call, AL sets the number of sectors (never
  42. is 7Fh) and SI is not necesary equal to 324Dh.  This lets 2M to detect your
  43. intention. You have not to fill big tables on ES:BX, simply point to a boot
  44. sector  of  future diskette. This boot sector can be obtained from standard
  45. 2M diskette already formatted. New INT 13h format function return the sames
  46. codes in AH that the BIOS standard routines.  Since 2.0 version of 2M,  the
  47. track 0  head 0 contains a virtual BOOT sector in the first physical sector
  48. of FAT2, and in high and extra-high density diskettes the SuperBOOT code in
  49. the second-sixth sectors of FAT2.  The FAT2 is emulated using FAT1 instead.
  50. The real BOOT sector is never shown in BIOS normal functions, and SuperBOOT
  51. code also can not be accessed through BIOS standard functions.  The virtual
  52. boot sector is equal to real one when 2MF formats a diskette,  but  can  be
  53. altered by SYS command, for example. If you desire to format a 2M diskette,
  54. and you want to make this diskette capable of SuperBOOT, you must write the
  55. real BOOT sector, the virtual BOOT sector *AND* the SuperBOOT code. This is
  56. possible using a little trick: when calling standard BIOS functions (read &
  57. write), select the 128 or 129 head (instead 0 and 1 ones).  This lets 2M to
  58. know  your  intention, and physical sectors will be read or written without
  59. emulations.  Note that first track of 2M diskette has less sectors than the
  60. rest,  so you must access no more than 1 (boot) + N (FAT1) + 1 (the virtual
  61. BOOT) + 5 (SuperBOOT code) = 7 + N sectors ... and with double density only
  62. must be accessed boot, FAT1 and virtual BOOT (no SuperBOOT code!).
  63.  
  64.       If disk is formatted using the STV technology (when offset 65 of boot
  65. record is equal to 1)  the completely track must be written after format to
  66. avoid future CRC errors on read.  This  does not is necessary on cylinder 0
  67. side 0. In cylinder 0 side 1 the track must be write using head 81h instead
  68. head 1. STV technology is used by 2MF if /M switch is present.
  69.  
  70.       You don't need to build your own boot  sectors,  buf if you decide to
  71. modify something, you must know:
  72.  
  73.      - 2M diskettes have always  TWO FAT  copies,  for hardware reasons. Do
  74.        not try to alter this specification (yes, for *hardware* reasons).
  75.      - Modifing system ID probably makes 2M not able to detect the diskette,
  76.        and standard BIOS will report sector-not-found errors.
  77.      - Yoy can modify the jump instruction at the begin  of  boot,  and the
  78.        boot code located after destination of this jump.  But  data located
  79.        from offset 63 to last byte before boot code is covered by checksum,
  80.        and you have to compute it if you modify something (the arithmetic 8
  81.        bits add off all bytes must be zero, use checksum byte to force it).
  82.      - Resuming: you can only modify offsets from 0 to 2, from 11 to 61 (it
  83.        is not recommended) and the boot code.
  84.      - If you try to write a boot sector with 2M installed, you will really
  85.        write the virtual boot sector, instead the real one.  With 2M loaded
  86.        on memory, the real boot sector can be modified only invocating BIOS
  87.        write function in head 128 or 129 (instead 0-1).  The  virtual  boot
  88.        sector is located on first sector of the second FAT copy (when 2M is
  89.        loaded, all BIOS access to second copy of FAT are emulated using the
  90.        first copy instead).  This  trick  makes  2M compatible with DOS SYS
  91.        command. And  much  more, the first track of 2M diskette has the DOS
  92.        standard format, with less space free where don't have room to place
  93.        the completely FAT2.
  94.      - If  the  boot  sector has a invalid checksum, a 'seek error' will be
  95.        reported.
  96.      - The virtual boot sector can be modify without problem, inside of the
  97.        reason limits.  Note  that  with 2M installed you can access to this
  98.        sector via standard DOS functions (sector 0) or BIOS (track 0 head 0
  99.        and sector 1), never through FAT2 ... this is *emulated* by 2M (this
  100.        emulation is only skipped while using head 128-129 instead 0-1).
  101.  
  102.       Here are the format of 2M diskettes, in order to meet your curiosity;
  103. 2M is not a secret or magic program!.  See  the  source code files for more
  104. information (if you don't understand the source code comments, you may come
  105. to Spain next summer :) ).
  106.  
  107.  * BOOT SECTOR OF 2M DISKETTE (COMMON TO ALL FORMATS).
  108.  
  109.           Assembler                        Comment                 Offset
  110.       ---------------------  ----------------------------------  ----------
  111.         JMP   BootP           ; 3 bytes                                0
  112.         DB    "2M-STV08"      ; system ID of 2M 1.80M diskette         3
  113.         DW    512             ; bytes per sector                      11
  114.         DB    1               ; sectors per cluster                   13
  115.         DW    1               ; sectors reserved at beginning         14
  116.         DB    2               ; number of FAT copies                  16
  117.         DW    224             ; root directory entries                17
  118.         DW    3772            ; total sectors on disk                 19
  119.         DB    0F0h            ; media descriptor                      21
  120.         DW    11              ; sectors ocupied by each FAT           22
  121.         DW    23              ; sectors per track                     24
  122.         DW    2               ; number of heads                       26
  123.         DD    0               ; special sectors reserved              28
  124.         DD    0               ; number of sectors (32 bit drives)     32
  125.         DB    0               ; physical drive                        36
  126.         DB    0               ; reserved                              37
  127.         DB    29h             ; DOS >= 4.0 diskette                   38
  128.         DD    4B368A0Eh       ; serial number (random)                39
  129.         DB    "NO NAME    "   ; disk label                            43
  130.         DB    "FAT12   "      ; FAT type                              54
  131.         DB    0               ; reserved by 2M                        62
  132.         DB    0               ; 2M checksum (if used)                 63
  133.         DB